import request from '@/utils/request';

// 获取PPT列表
export function getPPTList(page, size, keyword, subjectId, educationLevel) {
  return request({
    url: '/api/ppts/list',
    method: 'get',
    params: {
      page,
      size,
      keyword,
      subjectId,
      educationLevel
    }
  });
}

// 获取PPT详情
export function getPPTDetail(id) {
  return request({
    url: `/api/ppts/detail/${id}`,
    method: 'get'
  });
}

// 添加PPT
export function addPPT(data) {
  return request({
    url: '/api/ppts/add',
    method: 'post',
    data
  });
}

// 更新PPT
export function updatePPT(data) {
  return request({
    url: '/api/ppts/update',
    method: 'put',
    data
  });
}

// 删除PPT
export function deletePPT(id) {
  return request({
    url: `/api/ppts/delete/${id}`,
    method: 'delete'
  });
}

// 获取热门PPT
export function getHotPPTs(limit = 8) {
  return request({
    url: '/api/ppts/hot',
    method: 'get',
    params: { limit }
  });
}

// 获取最新PPT
export function getLatestPPTs(limit = 8) {
  return request({
    url: '/api/ppts/latest',
    method: 'get',
    params: { limit }
  });
}

// PPT查看统计
export function viewPPT(id) {
  return request({
    url: `/api/ppts/view/${id}`,
    method: 'post'
  });
}

// PPT下载统计
export function downloadPPT(id) {
  return request({
    url: `/api/ppts/download/${id}`,
    method: 'post'
  });
} 